package com.runoob.java;

import java.util.Arrays;

/**
 * 构造方法
 */
public class Puppy {

    int puppyAge;

    public Puppy() {

    }

    public Puppy(String name) {
        // 构造器， 参数name
        System.out.println("小狗的名字 = " + name);
    }

    public void setAge(int age) {
        this.puppyAge = age;
    }

    public int getPuppyAge() {
        System.out.println("小狗的年龄为： " + puppyAge);
        return puppyAge;
    }

    public static void main(String[] args) {
        // 创建一个Puppy对象
        Puppy myPuppy = new Puppy("tonny");

        // 设定age
        myPuppy.setAge(2);
        myPuppy.getPuppyAge();
        // 访问成员变量
        System.out.println("args = " + myPuppy.puppyAge);
    }
}
